package com.vne.skyemart.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.vne.skyemart.dao.BrandDao;
import com.vne.skyemart.model.Brand;
import com.vne.skyemart.service.BrandService;

@Service("brandService")
@Transactional(propagation = Propagation.SUPPORTS,readOnly = true)
public class BrandServiceImpl implements BrandService{
	@Autowired
	private BrandDao brandDao;

	public BrandDao getBrandDao() {
		return brandDao;
	}

	public void setBrandDao(BrandDao brandDao) {
		this.brandDao = brandDao;
	}
	public BrandServiceImpl() {}

	@Transactional(propagation = Propagation.SUPPORTS,readOnly = false)
	@Override
	public void addBrand(Brand brand) {
		brandDao.save(brand);		
	}

	@Override
	public List<Brand> listBrand() {
		return brandDao.findAll();
	}
	
}
